import React, { Component } from 'react';
import StrideChild11 from '../跨级组件通信/child1的子组件'
import { globalContext } from './globalData/js/globalData'
const { Consumer } = globalContext
class StrideChild extends Component {
    state = {

    }
    render() {
        return (<div>
            子组件child1
            {/* 读取父组件的role数据 */}
            <StrideChild11 />
            <Consumer>
                {
                    value=>(<div>
                        {value.tel}
                        <button onClick={()=>value.updateRole('zhangsna')}>修改role</button>
                    </div>)
                }
            </Consumer>
            {/* 插槽传来的内容 */}
            {this.props.children}
            <br />
            {/* footer内容 */}
            具名插槽：footer
            {
                this.props.footer
            }
        </div>);
    }
}

export default StrideChild;